mkdir /home/tools
firewall-cmd --add-port=7000/tcp --permanent
firewall-cmd --reload

echo "编译libzooker库"
yum install -y gcc gcc-c++ make automake libtool cppunit-devel ant
cd /home/tools
wget -c https://codeload.github.com/apache/zookeeper/tar.gz/release-3.5.9
mv release-3.5.9  zookeeper-release-3.5.9.tar.gz
tar -xzvf zookeeper-release-3.5.9.tar.gz
cd zookeeper-release-3.5.9
ant compile_jute
cd zookeeper-client/zookeeper-client-c
autoreconf -if
./configure --prefix=/usr/
make
make install
ldconfig


echo "安装sheepdog"
yum install -y corosync corosync-devel yasm gcc gcc-c++ make automake userspace-rcu-devel fuse-devel unzip
wget -c https://codeload.github.com/sheepdog/sheepdog/zip/refs/tags/v1.0.1
mv v1.0.1 sheepdog-1.0.1.zip
unzip sheepdog-1.0.1.zip
cd sheepdog-1.0.1
./autogen.sh
./configure --enable-zookeeper --enable-sheepfs
make install


echo "安装qemu 4.0.0"
yum install -y libvirt qemu-kvm
cd /home/tools
wget -c http://117.48.234.190:4000/qemu-4.0.0-1.el7.x86_64.rpm
rpm -ivh  qemu-4.0.0-1.el7.x86_64.rpm
mv /usr/libexec/qemu-kvm  /usr/libexec/qemu-kvm-1.5.3
ln -s /usr/local/qemu-4.0.0/bin/qemu-system-x86_64 /usr/libexec/qemu-kvm
mv /usr/bin/qemu-nbd  /usr/bin/qemu-nbd-1.5.3
ln -s /usr/local/qemu-4.0.0/bin/qemu-nbd /usr/bin/qemu-nbd
mv /usr/bin/qemu-io    /usr/bin/qemu-io-1.5.3
ln -s /usr/local/qemu-4.0.0/bin/qemu-io /usr/bin/qemu-io
mv /usr/bin/qemu-img  /usr/bin/qemu-img-1.5.3
ln -s /usr/local/qemu-4.0.0/bin/qemu-img /usr/bin/qemu-img

echo "启动 libvirt"
systemctl start libvirtd
systemctl status libvirtd
